package com.example.barcodeapp.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.example.barcodeapp.R;

public class XiangQingZhiBoKe extends RecyclerView.Adapter<XiangQingZhiBoKe.ViewHolder> {

    private Context context;

    public XiangQingZhiBoKe(Context context) {
        this.context = context;
    }
    private XiangQingZhiBoKe.IClick callback;
    public void setClick(XiangQingZhiBoKe.IClick cb){
        callback = cb;
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.adapter_zhiboxiangqing, parent, false);
        return new ViewHolder(inflate);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {

        if (position==2){
            Glide.with(context).load(R.drawable.suo).into(holder.suohzuangtai);
        }else if (position==5){
            Glide.with(context).load(R.drawable.suo).into(holder.suohzuangtai);
        }
    }

    @Override
    public int getItemCount() {
        return 10;
    }


    public class ViewHolder extends RecyclerView.ViewHolder {

        private TextView textView26;
        private TextView zhangjie;
        private ImageView suohzuangtai;
        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            textView26 = (TextView) itemView.findViewById(R.id.textView26);
            zhangjie = (TextView) itemView.findViewById(R.id.zhangjie);
            suohzuangtai = (ImageView) itemView.findViewById(R.id.suohzuangtai);
        }
    }

    public interface IClick{
        void click(int pos);
    }
}
